import request from '@/utils/request'
import QS from 'qs'
import { downFile } from '@/utils/request'

/**
 * 房型表分页查询
 * @param {查询条件} data
 */
export function listLayRoom(query) {
  return request({
    url: 'business/LayRoom/list',
    method: 'get',
    params: query,
    paramsSerializer: function (params) {
      return QS.stringify(params, { indices: false })
    }
  })
}
/**
 * 房型表分页查询
 * @param {查询条件} data
 */
export function listLayCompanyHouse() {
  return request({
    url: 'business/LayHouse/CompanyHouselist',
    method: 'get',
    // params: query,
    paramsSerializer: function (params) {
      return QS.stringify(params, { indices: false })
    }
  })
}
/**
 * 新增房型表
 * @param data
 */
export function addLayRoom(data) {
  return request({
    url: 'business/LayRoom',
    method: 'post',
    data: data,
  })
}
/**
 * 修改房型表
 * @param data
 */
export function updateLayRoom(data) {
  return request({
    url: 'business/LayRoom',
    method: 'PUT',
    data: data,
  })
}
/**
 * 获取房型表详情
 * @param {Id}
 */
export function getLayRoom(id) {
  return request({
    url: 'business/LayRoom/' + id,
    method: 'get'
  })
}

/**
 * 删除房型表
 * @param {主键} pid
 */
export function delLayRoom(pid) {
  return request({
    url: 'business/LayRoom/delete/' + pid,
    method: 'POST'
  })
}
// 导出房型表
export async function exportLayRoom(query) {
  await downFile('business/LayRoom/export', { ...query })
}
